home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Utilities / Text Utilities / Font list 1.0 / background_3325.txt < prev    next >
Encoding:
Text File  |  1988-04-07  |  3.8 KB  |  97 lines

  1. -- background: 3325 from stack: in.0
  2. -- bmap block id: 2699
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: Font List
  6. ----- HyperTalk script -----
  7. --**********************************************************
  8. --*    Font List Script   by Dr. John A. Koch   3/30/88    *
  9. --*                          Computer Science Department   *
  10. --*                          Wilkes College                *
  11. --*                          Wilkes-Barre, PA  18766       *
  12. --*                          CompuServe: 72457,736         *
  13. --*                          AppleLink: U0192              *
  14. --*                                                        *
  15. --*    This script is messageware.  Send me a message if   *
  16. --*    you find it useful or have suggestions.             *
  17. --*                                                        *
  18. --*    This stack is ¬©1988.  May not be sold for profit.   *
  19. --*                                                        *
  20. --*    This script gets a list of system fonts and sizes.  *
  21. --*    It saves and restores the original font settings.   *
  22. --*                                                        *
  23. --*    It returns 1 line per font with items as follows:   *
  24. --*                                                        *
  25. --*      item  1 is the font name                          *
  26. --*      items 2 through last are the font sizes           *
  27. --*                                                        *
  28. --* For example, this function might return:               *
  29. --* Chicago,12  -- one size (12) of the Chicago font       *
  30. --* Geneva,9,12 -- two sizes (9 and 12) of the Geneva font *
  31. --* Monaco,9    -- one size (9) of the Monaco font         *
  32. --*                                                        *
  33. --**********************************************************
  34.  
  35. function fontList
  36.  
  37. set the lockscreen to true
  38. hide menubar  -- if you don't want user to see menu changes
  39. put the userlevel into savelevel
  40. if savelevel < 3 then
  41.   set the userlevel to 3  -- must use paint tools
  42.   if the userlevel < 3 then
  43.     beep
  44.     exit fontList
  45.   end if
  46. end if
  47. put empty into x
  48. choose text tool
  49. put the textFont into saveFont
  50. put the textSize into saveSize
  51.  
  52. -- first go in increasing order up from "Chicago"
  53. set the textFont to "Chicago"  -- must be in system
  54. put empty into oldfont  -- so it will not be equal to textfont
  55. repeat until the textFont = oldfont
  56.   put empty into oldsize  -- so it will not be equal to textSize
  57.   set the textSize to 0  -- will get font size of 1, if any
  58.   type "." with commandkey  -- select the next larger size
  59.   put the textFont into z
  60.   repeat until the textSize = oldsize
  61.     put ", " & the textSize after z
  62.     put the textSize into oldsize
  63.     type "." with commandkey  -- select the next larger size
  64.   end repeat
  65.   put the textFont into oldfont
  66.   type "." with shiftkey, commandkey -- select the next larger font
  67.   put z & return after x
  68. end repeat
  69.  
  70. -- then go in decreasing order down from "Chicago"
  71. set the textFont to "Chicago"  -- must be in system
  72. type "," with shiftkey, commandkey -- select the next smaller font
  73. put "Chicago" into oldfont  -- may be equal if none are smaller
  74. repeat until the textFont = oldfont
  75.   put empty into oldsize  -- so it will not be equal to textSize
  76.   set the textSize to 0  -- will get font size of 1, if any
  77.   type "." with commandkey  -- select the next larger size
  78.   put the textFont into z
  79.   repeat until the textSize = oldsize
  80.     put ", " & the textSize after z
  81.     put the textSize into oldsize
  82.     type "." with commandkey  -- select the next larger size
  83.   end repeat
  84.   put the textFont into oldfont
  85.   type "," with shiftkey, commandkey -- select the next smaller font
  86.   put z & return before x
  87. end repeat
  88.  
  89. set the textFont to saveFont  -- restore old settings
  90. set the textSize to saveSize
  91. set the userlevel to savelevel
  92. show menubar  -- if you have hidden it
  93. choose browse tool
  94. set the lockscreen to false
  95. return x
  96. end fontList
  97.